/**
 *
 */
package com.ybkj.daijia.api.data;

import java.math.BigDecimal;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import org.springframework.util.CollectionUtils;

public class PushChargeStartTime {

    private Long id;

    private Integer startHour;//开始时间 时

    private Integer startMinute;//开始时间 分

    private Integer endHour;//结束时间 时

    private Integer endMinute;//结束时间  分

    private BigDecimal cost; //单价（起步价）

    private Double qblc;//起步里程(最后超过xx公里)

    private List<PushChargeStartDistance> chargeStartDistances;

    private Integer mfdhsj;//免费等候时间(分钟);

    private Integer dhsjUnit;//等候时间单位(分钟);

    private Integer dhsjThresholdt;//等候时间阀值(分钟);

    private BigDecimal dhsjCost; //等候时间收费

    private Double djglUnit;//代驾公里单位(公里);

    private Double djglThresholdt;//代驾公里阀值(公里);

    private BigDecimal djglCost; //代驾公里收费


    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Integer getStartHour() {
        return startHour;
    }

    public void setStartHour(Integer startHour) {
        this.startHour = startHour;
    }

    public Integer getStartMinute() {
        return startMinute;
    }

    public void setStartMinute(Integer startMinute) {
        this.startMinute = startMinute;
    }

    public Integer getEndHour() {
        return endHour;
    }

    public void setEndHour(Integer endHour) {
        this.endHour = endHour;
    }

    public Integer getEndMinute() {
        return endMinute;
    }

    public void setEndMinute(Integer endMinute) {
        this.endMinute = endMinute;
    }

    public BigDecimal getCost() {
        if (null == cost) {
            return BigDecimal.ZERO;
        }
        return cost;
    }

    public void setCost(BigDecimal cost) {
        this.cost = cost;
    }

    public Double getQblc() {
        if (null == qblc) {
            return 0d;
        }
        return qblc;
    }

    public void setQblc(Double qblc) {
        this.qblc = qblc;
    }

    public Integer getMfdhsj() {
        if (null == mfdhsj) {
            return 0;
        }
        return mfdhsj;
    }

    public void setMfdhsj(Integer mfdhsj) {
        this.mfdhsj = mfdhsj;
    }

    public Integer getDhsjUnit() {
        if (null == dhsjUnit) {
            return 0;
        }
        return dhsjUnit;
    }

    public void setDhsjUnit(Integer dhsjUnit) {
        this.dhsjUnit = dhsjUnit;
    }

    public Integer getDhsjThresholdt() {
        if (null == dhsjThresholdt) {
            return 0;
        }
        return dhsjThresholdt;
    }

    public void setDhsjThresholdt(Integer dhsjThresholdt) {
        this.dhsjThresholdt = dhsjThresholdt;
    }

    public BigDecimal getDhsjCost() {
        if (null == dhsjCost) {
            return BigDecimal.ZERO;
        }
        return dhsjCost;
    }

    public void setDhsjCost(BigDecimal dhsjCost) {
        this.dhsjCost = dhsjCost;
    }

    public Double getDjglUnit() {
        if (null == djglUnit) {
            return 0d;
        }
        return djglUnit;
    }

    public void setDjglUnit(Double djglUnit) {
        this.djglUnit = djglUnit;
    }

    public Double getDjglThresholdt() {
        if (null == djglThresholdt) {
            return 0d;
        }
        return djglThresholdt;
    }

    public void setDjglThresholdt(Double djglThresholdt) {
        this.djglThresholdt = djglThresholdt;
    }

    public BigDecimal getDjglCost() {
        if (null == djglCost) {
            return BigDecimal.ZERO;
        }
        return djglCost;
    }

    public void setDjglCost(BigDecimal djglCost) {
        this.djglCost = djglCost;
    }


    public List<PushChargeStartDistance> getChargeStartDistances() {
        if (!CollectionUtils.isEmpty(chargeStartDistances)) {
            Collections.sort(chargeStartDistances, new Comparator<PushChargeStartDistance>() {
                public int compare(PushChargeStartDistance arg0, PushChargeStartDistance arg1) {
                    return arg0.getDistance().compareTo(arg1.getDistance());
                }
            });

            for (int i = 0; i < chargeStartDistances.size(); i++) {
                if (i == 0) {
                    chargeStartDistances.get(i).setStartdistance(0d);
                } else {
                    chargeStartDistances.get(i)
                        .setStartdistance(chargeStartDistances.get(i - 1).getDistance());
                }
            }

        }

        return chargeStartDistances;
    }

    public void setChargeStartDistances(
        List<PushChargeStartDistance> chargeStartDistances) {
        this.chargeStartDistances = chargeStartDistances;
    }

    public boolean isEmpty() {
        if (null != startHour && null != startMinute && null != endHour && null != endMinute
            && null != cost) {
            return false;
        }
        return true;
    }


}
